#include <iostream>
using namespace std;
int main()
{
int x,ans;
cin>>x;
ans=0;
do
{
ans+=x%8;
x/=8;	
}while(x!=0);
cout <<ans<<endl;
return 0;	
}
//输入100 输出
